import { baseUrl } from './@/common/config.js'

//热门榜单
export function topList(){
	let listIds = ['3','0','2','1']
	return new Promise((reslove,reject) =>{
		uni.request({
			url:`${baseUrl}/toplist/detail`,
			method:'GET',
			data:{},
			success:res => {
				let result = res.data.list
				result.length = 4
				listIds.forEach((value,index) =>{
					result[index].listId = value
				})
				reslove(result)
			}
		})
	})
}
//榜单歌曲列表
export function list(listId){
	return uni.request({
		url:`${baseUrl}/top/list?idx=${listId}`,
		method:'GET'
	})
}
//音乐信息
export function songDetail(songId){
	return uni.request({
		url:`${baseUrl}/song/detail?ids=${songId}`,
		method:'GET'
	})
}
//相似歌曲
export function songSimi(songId){
	return uni.request({
		url:`${baseUrl}/simi/song?id=${songId}`,
		method:'GET'
	})
}
//评论
export function songComment(songId){
	return uni.request({
		url:`${baseUrl}/comment/music?id=${songId}`,
		method:'GET'
	})
}
//歌词
export function songLyric(songId){
	return uni.request({
		url:`${baseUrl}/lyric?id=${songId}`,
		method:'GET'
	})
}
//音乐地址
export function songUrl(songId){
	return uni.request({
		url:`${baseUrl}/song/url?id=${songId}`,
		method:'GET'
	})
}
//热搜
export function searchHot(){
	return uni.request({
		url:`${baseUrl}/search/hot/detail`,
		method:'GET'
	})
}
//搜索结果
export function searchWord(word){
	return uni.request({
		url:`${baseUrl}/search?keywords=${word}`,
		method:'GET'
	})
}
//下拉提示
export function searchSuggest(word){
	return uni.request({
		url:`${baseUrl}/search/suggest?keywords=${word}&type=mobile`,
		method:'GET'
	})
}